<div id="content">
  <div class="row s_page_title">
    <sa-big-breadcrumbs [items]="['算法管理', '渣土车标定结果']" icon="fa fa-subscript"
      class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
  </div>
  <sa-widgets-grid>
    <div class="s_table">
      <div sa-widget [editbutton]="false" color="darken" class="clearfix">
        <header>
          <span class="widget-icon"><i class="fa fa-table"></i></span>
          <h2>渣土车标定结果</h2>
        </header>
        <div>
          <div class="widget-body no-padding">
            <div class="page-header clearfix s_table_opreation">
              <div class="left page-header-btn" style="width: calc(100% - 300px)">
                <sa-company-tree-car companyTreeId="companyTree"
                  (companySelected)="companySelected($event)"></sa-company-tree-car>
                <div class="top_module top_module_box">
                  <span class="top_module_label module_text">是否标定成功</span>
                  <select name="" class="top_module_select" [(ngModel)]="isSuccess">
                    <option value="">全部</option>
                    <option value="0">失败</option>
                    <option value="1">成功</option>
                  </select>
                </div>
                <div class="selectDate top_module">
                  <table-select-date [notInit]="true" (outerTime)="getSelectTableTime($event)"></table-select-date>
                </div>
                <button class="btn btn-primary" (click)="table_search()">查询</button>
                <button type="button" class="btn btn-primary" (click)="exportData()">导出</button>
                <button type="button" class="btn btn-primary" (click)="handleFirmwareClick(firmwareModal)">固件选择</button>
              </div>
              <div class="right top-search">
                <input type="text" [(ngModel)]="searchKey" (change)="table_search()" class="search-input"
                  placeholder="公司、车牌号、设备ID..." />
                <span class="top-search-box">
                  <button class="top-search-btn" type="button" (click)="table_search()">
                    <i class="fa fa-search"></i>
                  </button>
                </span>
              </div>
            </div>
            <div class="table_scroll">
              <table
                class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
                <thead>
                  <tr>
                    <th>设备ID</th>
                    <th>车牌号码</th>
                    <th>厂区名称</th>
                    <th>标定时间</th>
                    <th>是否标定成功</th>
                    <th>原系数</th>
                    <th>标定输出系数</th>
                    <th>标定结果集</th>
                    <th>输入磅单正常数量</th>
                    <th>正常磅单数量</th>
                    <th>标定误差</th>
                    <th>交叉验证误差</th>
                    <th>交叉验证超差数</th>
                    <th>交叉验证5%达标占比</th>
                    <th>预标定屏蔽磅单数量</th>
                    <th>输入磅单数量</th>
                    <th>输入磅单列表</th>
                    <th>输入AD最早时间</th>
                    <th>输入AD最晚时间</th>
                    <th>输入的所有载重重量</th>
                    <th>GPS异常列表json</th>
                    <th>创建时间</th>
                  </tr>
                </thead>
                <tbody>
                  <tr *ngFor="let row of tableData; let i = index" [attr.data-index]="i"
                    [ngClass]="{ selected: activeSelected === row.id }" (dblclick)="checkAbnormal(row)">
                    <td>{{ row.deviceId }}</td>
                    <td>{{ row.carNumber }}</td>
                    <td>{{ row.companyName }}</td>
                    <td>{{ row.calibrationTime }}</td>
                    <td>{{ row.isSuccessText }}</td>
                    <td>{{ row.oldCoef }}</td>
                    <td>{{ row.outputCoef }}</td>
                    <td>{{ row.outputSuccessText }}</td>
                    <td>{{ row.outputNormalWeightNum }}</td>
                    <td>{{ row.outputWeightNum }}</td>
                    <td>{{ row.outputCalibrationError ? row.outputCalibrationError * 100 : 0 }}%</td>
                    <td>{{ row.outputCrossError ? row.outputCrossError * 100 : 0 }}%</td>
                    <td>{{ row.outputToleranceNum }}</td>
                    <td>{{ row.outputComplianceRatio ? row.outputComplianceRatio * 100 : 0 }}%</td>
                    <td>{{ row.outputShieldingWeightNum }}</td>
                    <td>{{ row.wbdNum }}</td>
                    <td>
                      <button *ngIf='row.wbdDataGroupList && row.wbdDataGroupList.length' type="button"
                        (click)="showWbdDataGroupListModal(row,wbdDataGroupModal)">查看</button>
                    </td>
                    <td>{{ row.startTimeAd }}</td>
                    <td>{{ row.endTimeAd }}</td>
                    <td>
                      <button *ngIf='row.weightInfo && row.weightInfo.length' type="button"
                        (click)="showWeightInfoModal(row,weightInfoModal)">查看</button>
                    </td>
                    <td>
                      <button *ngIf='row.gpsStatusListJson' type="button"
                        (click)="showGpsStatusListJsonModal(row,gpsStatusListJsonModal)">查看</button>
                    </td>
                    <td>{{ row.createTime }}</td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div class="table-fix clearfix">
              <paginator [totalRecords]="totalCount" [rows]="pageSize" [currentPage]="curPage - 1"
                (onPageChange)="paginate($event)"></paginator>
              <button type="button" class="btn default refresh_btn" (click)="refresh()">
                <i class="fa fa-refresh"></i>
              </button>
            </div>
          </div>
        </div>
      </div>
    </div>
  </sa-widgets-grid>

  <!-- 输入磅单列表详情 -->
  <div bsModal #wbdDataGroupModal="bs-modal" id="wbdDataGroupModal" class="modal fade" tabindex="-1" role="dialog"
    aria-labelledby="myLargeModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg" style="width: 1000px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" (click)="cancelWbdDataGroupListModal(wbdDataGroupModal)"
            aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <h4 class="modal-title">输入磅单列表详情</h4>
        </div>
        <div class="modal-body" style="padding: 15px 15px 30px 15px">
          <div class="table_scroll">
            <table
              class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
              <thead>
                <tr>
                  <th>车牌号</th>
                  <th>设备ID</th>
                  <th>过磅时间</th>
                  <th>磅单重量</th>
                </tr>
              </thead>
              <tbody>
                <tr *ngFor="let row of wbdDataGroupTableData">
                  <td>{{ row.carNumber }}</td>
                  <td>{{ row.deviceId }}</td>
                  <td>{{ row.date }}</td>
                  <td>{{ row.weight }}</td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- 输入磅单列表详情 end-->

  <!-- 输入的所有载重重量详情 -->
  <div bsModal #weightInfoModal="bs-modal" id="weightInfoModal" class="modal fade" tabindex="-1" role="dialog"
    aria-labelledby="myLargeModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg" style="width: 500px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" (click)="cancelWeightInfoModal(weightInfoModal)" aria-label="Close"><span
              aria-hidden="true">&times;</span></button>
          <h4 class="modal-title">输入的所有载重重量详情</h4>
        </div>
        <div class="modal-body" style="padding: 15px 15px 30px 15px">
          <div class="table_scroll">
            <table
              class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
              <tbody>
                <tr *ngFor="let row of weightInfoTableData">
                  <td>{{ row[0] }}</td>
                  <td>{{ row[1]}}</td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- 输入的所有载重重量详情 end-->

  <!-- GPS异常列表json -->
  <div bsModal #gpsStatusListJsonModal="bs-modal" id="gpsStatusListJsonModal" class="modal fade" tabindex="-1"
    role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg" style="width: 800px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" (click)="cancelGpsStatusListJsonModal(gpsStatusListJsonModal)"
            aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <h4 class="modal-title">GPS异常列表json</h4>
        </div>
        <div class="modal-body" style="padding: 15px 15px 30px 15px">
          <div class="table_scroll">
            <div>{{ gpsStatusListJsonData }}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- GPS异常列表json end-->


  <!-- 固件选择 -->
  <div bsModal #firmwareModal="bs-modal" id="firmwareModal" class="modal fade" tabindex="-1" role="dialog"
    aria-labelledby="myLargeModalLabel" aria-hidden="true" style="overflow: auto;">
    <div class="modal-dialog modal-lg" style="width: 1000px;">
      <div class="modal-content ">
        <div class="modal-header">
          <button type="button" class="close" (click)="closeModal(firmwareModal)" aria-label="Close"><span
              aria-hidden="true">&times;</span></button>
          <h4 class="modal-title">固件选择</h4>
        </div>
        <div class="modal-body" style="padding: 15px;">
          <div class="page-header clearfix s_table_opreation"
            style="margin-top: 0px;margin-bottom: 15px;padding-bottom: 15px;">
            <div class="page-header-btn">

              <!-- 公司的模块插入 -->
              <sa-company-tree-car #firmwareCompany companyTreeId="firmwareCompanyTree" wrapId="firmwareModal"
                [isShowCarSort]="false" [isShowCarNum]="false" [isLinkCompanyAndCar]='false'
                (companySelected)="handleFirmwareCompanyChange($event)"></sa-company-tree-car>

              <div class="form-group top_module">
                <label class="control-label inline_block bin_box">设备版本</label>
                <div class="inline_block">
                  <div class="top_module inline_block" style="margin:0;margin-left: -5px;">
                    <select name="" class="select2" id="binSelect2">
                      <option value=""></option>
                    </select>
                  </div>
                </div>
              </div>

              <button type="button" class="btn btn-primary" (click)="handleFirmwareCommit()">提交</button>
            </div>
          </div>

          <div class="table_scroll">
            <table
              class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
              <thead>
                <tr>
                  <th>固件名称</th>
                  <!-- <th>版本号</th> -->
                  <!-- <th>协议版本号</th> -->
                  <th>硬件版本号</th>
                </tr>
              </thead>
              <tbody>

                <tr *ngFor="let row of firmwareTableData; let i = index" [attr.data-index]="i"
                  [ngClass]='{selected: row.isChecked }'>
                  <td>{{row.binName}}</td>
                  <!-- <td>{{row.version}}</td> -->
                  <!-- <td>{{row.protocolVersion}}</td> -->
                  <td>{{row.hwVersion}}</td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- 固件选择 end-->
</div>